Class symantec.itools.awt.TreeView
All Packages Class Hierarchy This Package Previous Next Index
Class symantec.itools.awt.TreeView
Object
|
+----Component
|
+----Container
|
+----Panel
|
+----symantec.itools.awt.TreeView
- public class TreeView
- extends Panel
- implements ItemSelectable
Creates an "outline view" of text headings and, optionally, images.
The headings are arranged in a hierarchical fashion, and can be
expanded to show their sub-headings or collapsed, hiding their
sub-headings.
A TreeView is typically used to display information that is organized in a
hierarchical fashion like an index or table of contents.
A TreeNode object is used for each heading.
- See Also:
- TreeNode
-
CHILD
- Constant indicating that the new node is to be a child
of the existing node.
-
LAST
- Constant indicating that the new node is to be the last
sibling of the existing node.
-
NEXT
- Constant indicating that the new node is to be the next
sibling of the existing node.
-
NODE_COLLAPSED
- Constand used to detail that the node referenced in a NODE_TOGGLED ItemEvent has been collapsed.
-
NODE_EXPANDED
- Constand used to detail that the node referenced in a NODE_TOGGLED ItemEvent has been expanded.
-
NODE_TOGGLED
- Constand used to describe ItemEvents sent when a node is toggled.
-
SEL_CHANGED
-
-
actionListener
- The action listener to keep track of listeners for our action event.
-
adjustment
- The this component's adjustment event listener.
-
count
- Number of nodes in the tree.
-
e
- e is vector of existing nodes
-
errors
- Error strings.
-
fm
- current font metrics
-
focus
- The this component's focus event listener.
-
g1
- Offscreen graphics context used for buffering the painting process.
-
horizontalScrollBar
- The horizontal scrollbar
-
im1
- Offscreen Image used for buffering the painting process.
-
isSun1_1
- Checks for scrollbars that have different max value.
-
itemListener
- The action listener to keep track of listeners for our item event.
-
key
- The this component's key event listener.
-
mouse
- The this component's mouse event listener.
-
needResetVector
- Keeps track of if drawTree needs to call resetVector or not.
-
newWidth
- for horizontal scrollbar
-
redrawTriggered
- Flag indicating repaint() shoud redraw the entire image even
if the component size has not changed.
-
rootNode
- root node of tree
-
sbHLineIncrement
- Horizontal scroll bar unit increment.
-
sbHShow
- show or hide horizontal scrollbar
-
sbHSize
- size of horizontal scrollbar
-
sbVShow
- show or hide vertical scrollbar
-
selectedNode
- highlighted node
-
topVisibleNode
- first node in window
-
v
- v is vector of viewable nodes
-
verticalScrollBar
- The vertical scrollbar.
-
viewCount
- Number of viewable nodes in the tree.
-
viewHeight
- pixel size of tree display
-
viewWidest
- widest item displayable (for horz scroll)
-
viewWidth
- pixel size of tree display
-
symantec.itools.awt.TreeView()
- Constructs an empty TreeView.
-
symantec.itools.awt.TreeView(TreeNode)
- Constructs a TreeView with the given node.
-
addActionListener(ActionListener)
- Adds the specified action listener to receive action events
from this button.
-
addChild(TreeNode, TreeNode)
- Adds the specified child node to the specified parent node
Does not redraw the component.
-
addItemListener(ItemListener)
- Add a listener to recieve item events when the state of
an item changes.
-
addNotify()
- Tells this component that it has been added to a container.
-
addSibling(TreeNode, TreeNode)
- Adds the specified node as a sibling to the specified node
Does not redraw the component.
-
addSibling(TreeNode, TreeNode, boolean)
- Adds the specified node as a sibling to the specified node
Does not redraw the component.
-
append(TreeNode)
- Adds a new node at root level.
-
changeSelection(TreeNode)
- Handles selecting the given node.
-
clear()
- Clears the tree structure and redraws.
-
compWidth(Graphics)
- Calculates the maximum width of the tree.
-
debugVector()
- Internal use only.
-
drawDotLine(int, int, int, int)
- Internal helper method.
-
drawNodeText(TreeNode, int, boolean, boolean)
- Internal helper method.
-
drawNodeToggle(TreeNode, int, int)
- Used to draw the toggle box of an expandable node.
-
drawTree()
- Draws the TreeView into an offscreen image.
-
exists(TreeNode)
- Determines if the given node is in the TreeView.
-
exists(String)
- Determines if the node with the given text is in the TreeView.
-
findLastPreSpace(String)
- Internal helper method.
-
getBgHilite()
-
-
getCount()
- Returns the total number of nodes in the tree.
-
getFgHilite()
-
-
getMinimumSize()
- Returns the minimum dimensions to properly display this component.
-
getPreferredSize()
- Returns the recommended dimensions to properly display this component.
-
getRootNode()
- Returns the "root" node.
-
getSelectedNode()
- Gets the currently selected node.
-
getSelectedObjects()
- Returns the selected items or null if no items are selected.
-
getSelectedText()
- Gets the text of the currently selected node.
-
getTreeStructure()
- Gets a string array that reflects the current TreeView's contents.
-
getViewCount()
- Returns the total number of viewable nodes in the tree.
-
handleAdjustmentEvent(AdjustmentEvent)
- Handles adjustment events.
-
handleFocusGained(FocusEvent)
- Handles focus gained events.
-
handleFocusLost(FocusEvent)
- Handles focus lost events.
-
handleKeyPressed(KeyEvent)
- Handles key pressed events.
-
handleMousePressed(MouseEvent)
- Handles mouse pressed events.
-
handleMouseReleased(MouseEvent)
- Handles mouse released events.
-
insert(TreeNode, TreeNode, int)
- Inserts a new node relative to an existing node in the tree.
-
isFocusTraversable()
-
-
minimumSize()
-
-
newTreeNode(String, TreeView)
- Generates a new tree node.
-
paint(Graphics)
- Paints this component using the given graphics context.
-
parseTreeStructure(String[])
- Internal helper method.
-
preferredSize()
-
-
printTree(TreeNode)
- Print out the text of each node in the TreeView beginning with
the given node.
-
printTree(TreeNode, boolean)
- Print out the text of each node in the TreeView beginning with
the given node.
-
recount()
- Internal helper method.
-
redraw()
- Lays out the vertical scrollbar as needed, then draws the TreeView into
an offscreen image.
-
redraw(Graphics)
- Lays out the vertical scrollbar as needed, then draws the TreeView into
an offscreen image.
-
remove(String)
- Removes the node with the given text from the TreeView.
-
remove(TreeNode)
- Removes the given node from the TreeView.
-
removeActionListener(ActionListener)
- Removes the specified action listener so it no longer receives
action events from this button.
-
removeItemListener(ItemListener)
- Removes an item listener.
-
removeNotify()
- Tells this component that it is being removed from a container.
-
removeSelected()
- Removes the currently selected node from the TreeView.
-
repaint(boolean)
- Repaints this component.
-
resetVector()
- Internal helper method.
-
sendActionEvent()
- Sends an action performed event to any action listeners, as needed.
-
setLayout(LayoutManager)
- Takes no action.
-
setSelectedNode(TreeNode)
- Handles selecting the given node.
-
setTreeStructure(String[])
- Initializes the TreeView from a string array.
-
traverse(TreeNode)
- Internal helper method.
-
triggerRedraw()
- Triggers redrawing the entire image, even if the size of the component
has not changed.
-
update(Graphics)
- Handles redrawing of this component on the screen.
-
vectorize(TreeNode, boolean, boolean, Vector)
- Internal helper method.
CHILD
public static final int CHILD
- Constant indicating that the new node is to be a child
of the existing node.
- See Also:
- insert
LAST
public static final int LAST
- Constant indicating that the new node is to be the last
sibling of the existing node.
- See Also:
- insert
NEXT
public static final int NEXT
- Constant indicating that the new node is to be the next
sibling of the existing node.
- See Also:
- insert
NODE_COLLAPSED
public static final int NODE_COLLAPSED
- Constand used to detail that the node referenced in a NODE_TOGGLED ItemEvent has been collapsed.
- See Also:
- NODE_TOGGLED, NODE_EXPANDED
NODE_EXPANDED
public static final int NODE_EXPANDED
- Constand used to detail that the node referenced in a NODE_TOGGLED ItemEvent has been expanded.
- See Also:
- NODE_TOGGLED, NODE_COLLAPSED
NODE_TOGGLED
public static final int NODE_TOGGLED
- Constand used to describe ItemEvents sent when a node is toggled.
- See Also:
- NODE_EXPANDED, NODE_COLLAPSED
SEL_CHANGED
public static final int SEL_CHANGED
-
- Note: SEL_CHANGED is deprecated.
As of JDK version 1.1,
replaced by ItemSelectable interface.
- See Also:
- ItemSelectable
actionListener
protected java.awt.event.ActionListener actionListener
- The action listener to keep track of listeners for our action event.
adjustment
protected symantec.itools.awt.TreeView. Adjustment adjustment
- The this component's adjustment event listener.
count
protected int count
- Number of nodes in the tree.
e
protected java.util.Vector e
- e is vector of existing nodes
errors
protected transient java.util.ResourceBundle errors
- Error strings.
fm
protected transient java.awt.FontMetrics fm
- current font metrics
focus
protected symantec.itools.awt.TreeView. Focus focus
- The this component's focus event listener.
g1
protected transient java.awt.Graphics g1
- Offscreen graphics context used for buffering the painting process.
horizontalScrollBar
protected java.awt.Scrollbar horizontalScrollBar
- The horizontal scrollbar
im1
protected transient java.awt.Image im1
- Offscreen Image used for buffering the painting process.
isSun1_1
protected static boolean isSun1_1
- Checks for scrollbars that have different max value.
itemListener
protected java.awt.event.ItemListener itemListener
- The action listener to keep track of listeners for our item event.
key
protected symantec.itools.awt.TreeView. Key key
- The this component's key event listener.
mouse
protected symantec.itools.awt.TreeView. Mouse mouse
- The this component's mouse event listener.
needResetVector
protected boolean needResetVector
- Keeps track of if drawTree needs to call resetVector or not.
newWidth
protected int newWidth
- for horizontal scrollbar
redrawTriggered
protected transient boolean redrawTriggered
- Flag indicating repaint() shoud redraw the entire image even
if the component size has not changed.
rootNode
protected symantec.itools.awt.TreeNode rootNode
- root node of tree
sbHLineIncrement
protected int sbHLineIncrement
- Horizontal scroll bar unit increment.
sbHShow
protected boolean sbHShow
- show or hide horizontal scrollbar
sbHSize
protected int sbHSize
- size of horizontal scrollbar
sbVShow
protected boolean sbVShow
- show or hide vertical scrollbar
selectedNode
protected symantec.itools.awt.TreeNode selectedNode
- highlighted node
topVisibleNode
protected symantec.itools.awt.TreeNode topVisibleNode
- first node in window
v
protected java.util.Vector v
- v is vector of viewable nodes
verticalScrollBar
protected java.awt.Scrollbar verticalScrollBar
- The vertical scrollbar.
viewCount
protected int viewCount
- Number of viewable nodes in the tree.
A node is viewable if all of its parents are expanded.
viewHeight
protected int viewHeight
- pixel size of tree display
viewWidest
protected int viewWidest
- widest item displayable (for horz scroll)
viewWidth
protected int viewWidth
- pixel size of tree display
TreeView
public TreeView()
- Constructs an empty TreeView.
TreeView
public TreeView(TreeNode head)
- Constructs a TreeView with the given node.
- Parameters:
- head - the root node of the constructed tree
addActionListener
public synchronized void addActionListener(ActionListener l)
- Adds the specified action listener to receive action events
from this button.
- Parameters:
- l - the action listener
addChild
public void addChild(TreeNode newNode,
TreeNode relativeNode)
- Adds the specified child node to the specified parent node
Does not redraw the component. This allows you to call repeatedly without
causing the component to flicker while nodes are manipulated. After all
manipulation is done, repaint the tree.
- Parameters:
- newNode - the node to add as a child
- relativeNode - the node to add the child to.
addItemListener
public synchronized void addItemListener(ItemListener l)
- Add a listener to recieve item events when the state of
an item changes.
This is a standard method of the ItemSelectable interface.
- Parameters:
- l - the listener to recieve events
- See Also:
- ItemEvent
addNotify
public synchronized void addNotify()
- Tells this component that it has been added to a container.
This is a standard Java AWT method which gets called by the AWT when
this component is added to a container. Typically, it is used to
create this component's peer.
It has been overridden here to hook-up event listeners.
- Overrides:
- addNotify in class Panel
- See Also:
- removeNotify
addSibling
public void addSibling(TreeNode newNode,
TreeNode siblingNode)
- Adds the specified node as a sibling to the specified node
Does not redraw the component. This allows you to call repeatedly without
causing the component to flicker while nodes are manipulated. After all
manipulation is done, repaint the tree.
- Parameters:
- newNode - the node to add as a sibling
- siblingNode - a sibling node to the new node.
- See Also:
- addSibling(symantec.itools.awt.TreeNode, symantec.itools.awt.TreeNode, boolean)
addSibling
public void addSibling(TreeNode newNode,
TreeNode siblingNode,
boolean asLastSibling)
- Adds the specified node as a sibling to the specified node
Does not redraw the component. This allows you to call repeatedly without
causing the component to flicker while nodes are manipulated. After all
manipulation is done, repaint the tree.
- Parameters:
- newNode - the node to add as a sibling
- siblingNode - a sibling node to the new node.
- asLastSibling - if true, then add the new node as the last (bottommost)
sibling node to the specified sibling node.
- See Also:
- addSibling(symantec.itools.awt.TreeNode, symantec.itools.awt.TreeNode)
append
public void append(TreeNode newNode)
- Adds a new node at root level. If there is no root node, the given
node is made the root node. If there is a root node, the given node
is made a sibling of the root node.
Does not redraw the component. This allows you to call repeatedly without
causing the component to flicker while nodes are manipulated. After all
manipulation is done, repaint the tree.
- Parameters:
- newNode - the new node to add
- See Also:
- insert
changeSelection
protected void changeSelection(TreeNode node)
- Handles selecting the given node.
- Parameters:
- node - the node to select
clear
public void clear()
- Clears the tree structure and redraws.
compWidth
protected int compWidth(Graphics gg)
- Calculates the maximum width of the tree.
- Parameters:
- gg - the Graphics context to use for the calculation
- Returns:
- the maximum tree width, in pixels
debugVector
protected void debugVector()
- Internal use only.
drawDotLine
protected void drawDotLine(int x0,
int y0,
int x1,
int y1)
- Internal helper method.
Draws a dotted line.
- Parameters:
- x0 - starting x position
- y0 - starting y position
- x1 - ending x position
- y1 - ending y position
drawNodeText
protected void drawNodeText(TreeNode node,
int yPosition,
boolean eraseBackground,
boolean eraseLines)
- Internal helper method.
Draws the text of the given tree node.
- Parameters:
- node - the tree node whose text is drawn
- yPosition - the vertical drawing position for the node
- eraseBackground -
true
to erase the background behind the text
- eraseLines -
true
to erase the node's text lines before redrawing
drawNodeToggle
protected void drawNodeToggle(TreeNode node,
int x,
int y)
- Used to draw the toggle box of an expandable node.
Override to change the look of the toggle box.
drawTree
public void drawTree()
- Draws the TreeView into an offscreen image. This is used for cleaner refresh.
exists
public boolean exists(TreeNode node)
- Determines if the given node is in the TreeView.
- Parameters:
- node - the node to check
- Returns:
- true if the node is in the TreeView, false if it is not
- See Also:
- exists(java.lang.String)
exists
public boolean exists(String s)
- Determines if the node with the given text is in the TreeView.
- Parameters:
- s - the node text to find
- Returns:
- true if the node is in the TreeView, false if it is not
- See Also:
- exists(symantec.itools.awt.TreeNode)
findLastPreSpace
protected int findLastPreSpace(String s)
- Internal helper method.
Counts the number of spaces before the node text starts.
- Parameters:
- s - the node text
- Returns:
- the number of spaces before the texxt starts
getBgHilite
public java.awt.Color getBgHilite()
- Note: getBgHilite() is deprecated.
As of JDK version 1.1,
replaced by use of SystemColors.textHighlight.
-
getCount
public int getCount()
- Returns the total number of nodes in the tree.
getFgHilite
public java.awt.Color getFgHilite()
- Note: getFgHilite() is deprecated.
As of JDK version 1.1,
replaced by use of SystemColors.textHighlightText.
-
getMinimumSize
public synchronized java.awt.Dimension getMinimumSize()
- Returns the minimum dimensions to properly display this component.
This is a standard Java AWT method which gets called to determine
the minimum size of this component.
- Overrides:
- getMinimumSize in class Container
- See Also:
- getPreferredSize
getPreferredSize
public synchronized java.awt.Dimension getPreferredSize()
- Returns the recommended dimensions to properly display this component.
This is a standard Java AWT method which gets called to determine
the recommended size of this component.
- Overrides:
- getPreferredSize in class Container
- See Also:
- getMinimumSize
getRootNode
public symantec.itools.awt.TreeNode getRootNode()
- Returns the "root" node.
The root node is the first top-level node in the tree hierarchy.
All other nodes are either children or siblings of that one.
- Returns:
- the root tree node
getSelectedNode
public symantec.itools.awt.TreeNode getSelectedNode()
- Gets the currently selected node.
- Returns:
- the currently selected node, or null if none selected
getSelectedObjects
public java.lang.Object[] getSelectedObjects()
- Returns the selected items or null if no items are selected.
This is a standard method of the ItemSelectable interface.
getSelectedText
public java.lang.String getSelectedText()
- Gets the text of the currently selected node.
- Returns:
- the text of the currently selected node or null if no node
is selected
getTreeStructure
public java.lang.String[] getTreeStructure()
- Gets a string array that reflects the current TreeView's contents.
There is one string for each node in the array. That string
contains the text of the node indented with same number of
leading spaces as the depth of that node in the tree.
- Returns:
- the string array that reflects the TreeView's contents
- See Also:
- setTreeStructure
getViewCount
public int getViewCount()
- Returns the total number of viewable nodes in the tree.
A node is viewable if all of its parents are expanded.
handleAdjustmentEvent
protected void handleAdjustmentEvent(AdjustmentEvent event)
- Handles adjustment events.
This function will get called when the component recives a adjustment event.
Override to change the way adjustment is handled.
- Parameters:
- event - the AdjustmentEvent
handleFocusGained
protected void handleFocusGained(FocusEvent event)
- Handles focus gained events.
This function will get called when the component recives a focus gained event.
Override to change the way focus gained is handled.
- Parameters:
- event - the FocusEvent
- See Also:
- handleFocusLost
handleFocusLost
protected void handleFocusLost(FocusEvent event)
- Handles focus lost events.
This function will get called when the component recives a focus lost event.
Override to change the way focus lost is handled.
- Parameters:
- event - the FocusEvent
- See Also:
- handleFocusGained
handleKeyPressed
protected void handleKeyPressed(KeyEvent event)
- Handles key pressed events.
This function will get called when the component recives a key pressed event.
Override to change the way key pressed is handled.
- Parameters:
- event - the KeyEvent
handleMousePressed
protected void handleMousePressed(MouseEvent event)
- Handles mouse pressed events.
This function will get called when the component recives a mouse pressed event.
Override to change the way mouse pressed is handled.
- Parameters:
- event - the MouseEvent
- See Also:
- handleMouseReleased
handleMouseReleased
protected void handleMouseReleased(MouseEvent event)
- Handles mouse released events.
This function will get called when the component recives a mouse released event.
Override to change the way mouse released is handled.
- Parameters:
- event - the MouseEvent
- See Also:
- handleMousePressed
insert
public void insert(TreeNode newNode,
TreeNode relativeNode,
int position)
- Inserts a new node relative to an existing node in the tree.
- Parameters:
- newNode - the new node to insert into the tree
- relativeNode - the existing node used for a position reference
- position - where to insert the new node relative to relativeNode.
Legal values are CHILD, NEXT and LAST.
- See Also:
- CHILD, NEXT, LAST, append
isFocusTraversable
public boolean isFocusTraversable()
- Overrides:
- isFocusTraversable in class Component
minimumSize
public synchronized java.awt.Dimension minimumSize()
- Note: minimumSize() is deprecated.
-
- Overrides:
- minimumSize in class Container
- See Also:
- getMinimumSize
newTreeNode
protected symantec.itools.awt.TreeNode newTreeNode(String text,
TreeView treeView)
- Generates a new tree node.
Override if you want to return your own instantiation of a TreeNode subclas.
- Parameters:
- text - the node text
- treeView - a reference to the parent TreeView (usually "this").
- Returns:
- a new TreeNode
paint
public void paint(Graphics g)
- Paints this component using the given graphics context.
This is a standard Java AWT method which typically gets called
by the AWT to handle painting this component. It paints this component
using the given graphics context. The graphics context clipping region
is set to the bounding rectangle of this component and its [0,0]
coordinate is this component's top-left corner.
- Parameters:
- g - the graphics context used for painting
- Overrides:
- paint in class Container
- See Also:
- repaint, update
parseTreeStructure
protected void parseTreeStructure(String[] tempStructure) throws InvalidTreeNodeException
- Internal helper method.
Process the given array of Strings, creating TreeNodes and appending them to this
component. Existing TreeNodes are kept.
- Parameters:
- tempStructure - the String array to parse
- Throws: InvalidTreeNodeException
- if there is a problem with the String array values
preferredSize
public synchronized java.awt.Dimension preferredSize()
- Note: preferredSize() is deprecated.
-
- Overrides:
- preferredSize in class Container
- See Also:
- getPreferredSize
printTree
public void printTree(TreeNode node)
- Print out the text of each node in the TreeView beginning with
the given node.
The nodes are printed out one per line with no indenting.
- Parameters:
- node - the first node to print
printTree
public void printTree(TreeNode node,
boolean isIndented)
- Print out the text of each node in the TreeView beginning with
the given node.
- Parameters:
- node - the first node to print
- isIndented, - if true, nodes will have hierarchical indenting,
if false, all nodes will pe printed at the same level
recount
protected void recount()
- Internal helper method.
Rebuilds the Vector e of nodes, adjusting node depth and maintaining an
overall count as it goes along.
Calls the recursive method traverse to do the meat of the job.
redraw
public void redraw()
- Lays out the vertical scrollbar as needed, then draws the TreeView into
an offscreen image. This is used for cleaner refresh.
redraw
public void redraw(Graphics g)
- Lays out the vertical scrollbar as needed, then draws the TreeView into
an offscreen image. This is used for cleaner refresh.
- Parameters:
- g - the graphics object use for drawing
remove
public symantec.itools.awt.TreeNode remove(String s)
- Removes the node with the given text from the TreeView.
Does not redraw the component. This allows you to call repeatedly without
causing the component to flicker while nodes are manipulated. After all
manipulation is done, repaint the tree.
- Parameters:
- s - the node text to find
- Returns:
- the TreeNode removed from this TreeView or null if not found
- See Also:
- remove(symantec.itools.awt.TreeNode), removeSelected
remove
public void remove(TreeNode node)
- Removes the given node from the TreeView.
Does not redraw the component. This allows you to call repeatedly without
causing the component to flicker while nodes are manipulated. After all
manipulation is done, repaint the tree.
- Parameters:
- node - the node to remove
- Returns:
- the TreeNode removed from this TreeView or null if not found
- See Also:
- remove(java.lang.String), removeSelected
removeActionListener
public synchronized void removeActionListener(ActionListener l)
- Removes the specified action listener so it no longer receives
action events from this button.
- Parameters:
- l - the action listener
removeItemListener
public synchronized void removeItemListener(ItemListener l)
- Removes an item listener.
This is a standard method of the ItemSelectable interface.
- Parameters:
- l - the listener being removed
- See Also:
- ItemEvent
removeNotify
public synchronized void removeNotify()
- Tells this component that it is being removed from a container.
This is a standard Java AWT method which gets called by the AWT when
this component is removed from a container. Typically, it is used to
destroy the peers of this component and all its subcomponents.
It has been overridden here to unhook event listeners.
- Overrides:
- removeNotify in class Container
- See Also:
- addNotify
removeSelected
public void removeSelected()
- Removes the currently selected node from the TreeView.
Does not redraw the component. This allows you to call repeatedly without
causing the component to flicker while nodes are manipulated. After all
manipulation is done, repaint the tree.
- See Also:
- remove(symantec.itools.awt.TreeNode), remove(java.lang.String)
repaint
public void repaint(boolean f)
- Repaints this component.
- Parameters:
- f -
true
to re-vectorize if the node arrangement has changed
resetVector
protected void resetVector()
- Internal helper method.
Traverses tree to put nodes into vector v
for internal processing. Depths of nodes are set,
and viewCount and viewWidest is set.
Calls the recursive method vectorize to do the meat of the job.
sendActionEvent
protected void sendActionEvent()
- Sends an action performed event to any action listeners, as needed.
setLayout
public void setLayout(LayoutManager lm)
- Takes no action.
This is a standard Java AWT method which gets called to specify
which layout manager should be used to layout the components in
standard containers.
Since layout managers CANNOT BE USED with this container the standard
setLayout has been OVERRIDDEN for this container and does nothing.
- Parameters:
- lm - the layout manager to use to layout this container's components
(IGNORED)
- Overrides:
- setLayout in class Container
- See Also:
- getLayout
setSelectedNode
public void setSelectedNode(TreeNode node)
- Handles selecting the given node.
- Parameters:
- node - the node to select
setTreeStructure
public void setTreeStructure(String[] s)
- Initializes the TreeView from a string array.
There is one string for each node in the array. That string
contains the text of the node indented with same number of
leading spaces as the depth of that node in the tree.
- Parameters:
- s - the string array used for initialization.
If null, the tree will be cleared.
- See Also:
- getTreeStructure
traverse
protected void traverse(TreeNode node)
- Internal helper method.
Recursive method that rebuilds the Vector e of nodes,
adjusting node depth and maintaining an
overall count as it goes along.
triggerRedraw
public void triggerRedraw()
- Triggers redrawing the entire image, even if the size of the component
has not changed.
update
public void update(Graphics g)
- Handles redrawing of this component on the screen.
This is a standard Java AWT method which gets called by the Java
AWT (repaint()) to handle repainting this component on the screen.
The graphics context clipping region is set to the bounding rectangle
of this component and its [0,0] coordinate is this component's
top-left corner.
Typically this method paints the background color to clear the
component's drawing space, sets graphics context to be the foreground
color, and then calls paint() to draw the component.
It is overridden here to reduce flicker by eliminating the uneeded
clearing of the background.
- Parameters:
- g - the graphics context
- Overrides:
- update in class Container
- See Also:
- repaint, paint
vectorize
protected void vectorize(TreeNode node,
boolean respectExpanded,
boolean repectHidden,
Vector nodeVector)
- Internal helper method.
Traverses tree to put nodes into the given vector for for processing.
Depths of nodes are set.
- Parameters:
- node - the current node
- respectExpanded -
true
to only follow expanded child links
- repectHidden -
true
to not follow hidden child links
- nodeVector - Vector to add the processed nodes to
All Packages Class Hierarchy This Package Previous Next Index